package com.baizhi.serviceplus.impl;

import com.baizhi.entity.Guru;
import com.baizhi.service.GuruService;
import com.baizhi.serviceplus.GuruServicePlus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
@Service
public class GuruServicePlusImpl implements GuruServicePlus {
    @Autowired
    private GuruService guruService;

    @Override
    public Map delete(Integer id) {
        Map map=new HashMap();
        try {
            guruService.delete(id);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;

    }

    @Override
    public Map insert(Guru guru) {
        Map map=new HashMap();
        try {
            guruService.insert(guru);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }

    @Override
    public Map update(Guru guru) {
        Map map=new HashMap();
        try {
            guruService.update(guru);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }
}
